<template>
  <div>
    <render-table
      ref="table"
      :apiUrl="getFalseSupplier"
      :tableColumn="tableColumn"
      :otherConfig="otherConfig"
      :setupConfig="setupConfig"
      :searchReset="searchReset"
      :searchConfig="searchConfig"
    >
    <template v-slot:state="{ row }">
        <el-tag
          type="danger"
          v-if="row.state === '0'"
          style="margin-left: 10px"
          >未报价</el-tag
        >
        <el-tag
          type="primary"
          v-else-if="row.state === '1'"
          style="margin-left: 10px"
          >已报价</el-tag
        ></template>
        <template v-slot:setup="{ row }">
        <el-button
          v-if="row.state === '0'"
          size="medium"
          type="text"
          @click="remind(row)"
          >提醒报价</el-button
        ></template>
    </render-table>
  </div>
</template>
      
      <script>
import { getFalseSupplier,remind } from "@/api/order/api";

export default {
  props: {
    searchReset: {
      // 搜索条件默认值重置值
      type: Object,
      default: () => {
                  return {
                    orderId: '',
                    state:'1'
                  }
              }
    },
  },
  name: "supplyTable",
  data() {
    return {
      searchConfig: [
        {
          type: "select",
          key: "state",
          selectList:[
            {
              listLabel:'未报价',
              listValue:'0',
            },
            {
              listLabel:'已报价',
              listValue:'1',
            }
          ],
          listLabel:'listLabel',
          listValue:'listValue',
          placeholder: "请选择状态",
        },
      ],
      setupConfig: {
        width: 100,
      },
      dict: {},
      otherConfig: {
        list: "rows",
      },
      getFalseSupplier,
      tableColumn: [
        { prop: "corporateName", label: "公司名称" },
        { prop: "state", label: "是否报价", slot: true  },
      ],
    };
  },
  created() {},
  methods: {
    remind(row){
      this.$confirm("是否提醒该公司报价?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          remind({supplierId:row.supplierId}).then(()=>{
            this.$message({
              type: "success",
              message: "已经短信通知提醒该公司报价",
            });
          })
            
        })
        .catch(() => {});
    }
  },
};
</script>
      